package com.guigu.yh.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * 应用程序上下文配置
 *
 * @author zyh
 * @version 1.0.0
 * @date 2022/08/16
 */
@Configuration
public class ApplicationContextConfig {
    /**
     * 快捷访问http服务模板，交给容器管理
     *
     * @return {@link RestTemplate }
     * @author zyh
     * @date 2022/08/16
     * @version 1.0.0
     */
    @Bean
    @LoadBalanced //开启负载均衡注解，默认轮询
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
